import {
  getList as getMesTechnologyList,
  getTechnologyTypeList as getMesTechnologyTechnologyTypeList,
  getTechnologyStatusList as getMesTechnologyTechnologyStatusList,
} from "@/api/order/mesTechnology";

export const mesTechnologyDialog = {
  data() {
    return {
      mesTechnologyDialogVisible: false, //表格弹框隐藏显示
      getMesTechnologyList, // 获取弹框数据接口
      hasMesTechnologyFooter: true, // 是否需要底部按钮默认true
      mesTechnologySearchDialog: {
        inline: true,
        formDesc: {
          technologyCode: {
            type: "input",
            layout: 8,
            label: $i18n.t('ele-dialog-table.technologyCode'),
          },
          technologyName: {
            type: "input",
            layout: 8,
            label: $i18n.t('ele-dialog-table.technologyName'),
          },
          prodCode: {
            type: "input",
            layout: 8,
            label: $i18n.t('ele-dialog-table.seriesCode'),
          },
          prodName: {
            type: "input",
            layout: 8,
            label: $i18n.t('ele-dialog-table.seriesName'),
          },
          technologyStatus: {
            type: "select",
            layout: 8,
            label: $i18n.t('ele-dialog-table.technologyStatus'),
            prop: {
              value: "value",
              text: "description",
            },
            options: async (data) => {
              const list = await getMesTechnologyTechnologyStatusList();
              return list.data.result;
            },
          },
          versionNumber: {
            type: "input",
            layout: 8,
            label: $i18n.t('ele-dialog-table.versionNumber'),
          },
        },
      },
      mesTechnologyDialogColumn: [
        {
          type: "selection",
        },
        {
          type: "index",
          label: $i18n.t("common.order"),
        },
        {
          prop: "technologyCode",
          label: $i18n.t("mesSalesOrder.technologyCode"),
        },
        {
          prop: "technologyName",
          label: $i18n.t("mesSalesOrder.technologyName"),
        },
        {
          prop: "technologyType",
          label: $i18n.t("mesSalesOrder.technologyType"),
          optionProp: {
            value: "value",
            label: "description",
          },
          option: async (data) => {
            const list = await getMesTechnologyTechnologyTypeList();
            return list.data.result;
          },
        },
        {
          prop: "prodCode",
          label: $i18n.t("mesSalesOrder.prodCode"),
          width: 150,
        },
        {
          prop: "prodName",
          label: $i18n.t("mesSalesOrder.prodName"),
          width: 150,
        },
        {
          prop: "standardTime",
          label: $i18n.t('ele-dialog-table.standardTime'),
          width: 120,
        },
        {
          prop: "assistTime",
          label: $i18n.t('ele-dialog-table.assistTime'),
          width: 120,
        },
        {
          prop: "technologyStatus",
          label: $i18n.t("mesSalesOrder.technologyStatus"),
          optionProp: {
            value: "value",
            label: "description",
          },
          option: async (data) => {
            const list = await getMesTechnologyTechnologyStatusList();
            return list.data.result;
          },
        },
        {
          prop: "versionNumber",
          label: $i18n.t("mesSalesOrder.versionNumber"),
        },
        {
          prop: "factoryCode",
          label: $i18n.t("mesSalesOrder.factoryCode"),
        },
        {
          prop: "Remark",
          label: $i18n.t("mesSalesOrder.Remark"),
          render: (h, { row }) => {
            let data = row.Remark == undefined ? "" : row.Remark;
            let str = data.length > 10 ? data.substring(0, 10) + "..." : data;
            return (
              <el-tooltip
                class="item"
                effect="dark"
                content={data}
                placement="top"
              >
                <span>{str}</span>
              </el-tooltip>
            );
          },
        },
        {
          prop: "createByName",
          label: $i18n.t("common.createByName"),
          width: 150,
        },
        {
          prop: "createTime",
          label: $i18n.t("common.createTime"),
          width: 150,
        },
        {
          prop: "updateByName",
          label: $i18n.t("common.updateByName"),
          width: 150,
        },
        {
          prop: "updateTime",
          label: $i18n.t("common.updateTime"),
          width: 150,
        },
      ],
    };
  },
};
